﻿<div class="frame_main">
    <ul>
        <li class="frame_title_line">
            <div class="frame_title">我的照片</div>
        </li>

        <li class="detaile_line">
            <table>
                <tbody>
                    <tr class="td_head" height="45">
                        <td style="width:10%;">选择</td>
                        <td style="width:20%;">缩略图</td>
                        <td style="width:40%;">分享给</td>
                        <td style="width:30%;">操作</td>
                    </tr>
                    @if (Model != null)
                    {
                        foreach (var item in Model)
                        {
                            var sharesName = "";
                            foreach (var str in item.Share_Images)
                            {
                                sharesName += str.Students.Name + ",";
                            }
                            if (sharesName!="")
                            { 
                                sharesName = sharesName.Substring(0, sharesName.Length - 1);
                            }
                            <tr>
                                <td><input type="checkbox" value="@item.ID" /></td>
                                <td><img src="@item.ImagePath" /> </td>
                                <td>@sharesName</td>
                                <td>
                                    <p>
                                        <a href="javascript:;" onclick="window.open('@Url.Action("Details_Images", "Interaction", new { id = item.ID })', '', 'height=500,width=820,status=1,toolbar=no,menubar=no,location=no,scrollbars=yes,left=200,top=100,resizable=yes');">详情</a>
                                        <a href="javascript:;" onclick="GetImages_Comments(@item.ID)">管理评论</a>
                                    </p>
                                    <p>
                                        <a href="@Url.Action("Edit_Images", "Interaction", new { id = item.ID })">修改</a>
                                        <a href="javascript:;" onclick="window.open('@Url.Action("Details_HomeWork", "Study",new {id= item.ID})', '', 'height=500,width=820,status=1,toolbar=no,menubar=no,location=no,scrollbars=yes,left=200,top=100,resizable=yes');">分享</a>
                                        <a href="javascript:;" onclick="Delete_This(@item.ID)">删除</a>
                                    </p>
                                </td>
                            </tr>
                        }
                    }
                    <tr>
                        <td colspan="8" style="text-align:left;">
                            <input type="checkbox" onclick="Check_all(this);"><label>全选</label>&nbsp;
                            <a href="javascript:;" onclick="Delete_Checked()" title="删除所选照片评论">
                                <img src="~/Images/delete.gif" style="vertical-align:middle">删除
                            </a>&nbsp;
                        </td>
                    </tr>
                </tbody>
            </table>
        </li>
    </ul>
</div>
<script type="text/javascript" src="~/Content/EasyUi/jquery.easyui.min.js"></script>
<script>
    function Check_all(org)
    {
        if ($(org).attr("checked") == "checked")
            $("table :checkbox").attr("checked", true);
        else
            $("table :checkbox").attr("checked", false);
    }
    function Delete_This(id)
    {
        Del_Fun(id);
    }
    function Delete_Checked()
    {
        var ids="";
        $("table :checkbox:checked").each(function (index) {
            ids += $(this).val()+",";
        })
        Del_Fun(ids);
    }
    function Del_Fun(id){
        $.messager.confirm('警告', '你确定要删除吗?', function (r) {
            if (r) {
                $.post(
                    "@Url.Action("DelImage", "Interaction")",
                    { "ids": id },
                    function () {
                        location.reload();
                    });
            }
        });
    }
</script>